import { post } from "./request";

export const getTypes = ({ success, fail }) => {
    post({
        url: "type-lists",
        success,
        fail
    });
};
export const getLists = ({ success, fail, data }) => {
    post({
        url: "article-lists",
        success,
        data,
        fail
    });
};

export const logon = ({ success, fail, data }) => {
    // {
    //     "phone": "18338761781",
    //     "passWord": "946513",
    //     "nickName": "darly"
    // }
    post({
        url: "logon",
        success,
        data,
        fail
    });
};

export const login = ({ success, fail, data }) => {
    // {
    //     "phone": "18338761781",
    //     "passWord": "946513"
    // }
    post({
        url: "login",
        success,
        data,
        fail
    });
};

export const user = ({ success, fail, data }) => {
    // {
    //     "token": "b8f7fd8777883000"
    // }
    post({
        url: "user",
        success,
        data,
        fail
    });
};

export const publish = ({ success, fail, data }) => {
    // {
    //     "token":"b8f7fd8777883000" ,
    //     "typeID": "5e92aa2103ec7128174c43cf",
    //     "title": "测试数据2",
    //     "content": "这是一个测试数据2",
    //     "createdAt": "1585145589180"
    // }
    post({
        url: "publish",
        success,
        data,
        fail
    });
};

export const article = ({ success, fail, data }) => {
    // {
    // id: "5e92aefed04e99090a7cec68"
    // }
    post({
        url: "article",
        success,
        data,
        fail
    });
};
export const upload = ({ success, fail, data }) => {
    // {
    // data: new formdata()
    // }
    post({
        url: "upload",
        success,
        data,
        fail
    });
};